home *** CD-ROM | disk | FTP | other *** search
- Path: alterdial.uu.net!not-for-mail
- From: Chris Gould <cgould@dataware.com>
- Newsgroups: comp.lang.c++
- Subject: Re: [HELP!!!] Segmentation Fault!
- Date: Mon, 08 Apr 1996 14:49:22 -0400
- Organization: Dataware Technologies, Inc.
- Message-ID: <31695FB2.31@dataware.com>
- References: <4k4gja$mm@nuscc.nus.sg>
- NNTP-Posting-Host: gw.dataware.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- In ReadNextField you are returning a pointer to a local variable (str.)
-
- char* SpaceStudentFile::readNextField()
- {
- char str[40];
-
- ...
- return str;
- ...
- }
-
- The pointer you return is therefore invalid. Either pass storage into this function
- or allocate new storage inside the function.
-